package com.hongguan.oms.service.supervise;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hongguan.oms.domain.plan.PlanInfoModel;
import com.hongguan.oms.domain.plan.PlanTaskModel;
import com.hongguan.oms.domain.plan.TaskExecutorModel;
import com.hongguan.oms.domain.supervise.SuperviseInfoModel;
import com.hongguan.oms.service.ProxyService;

/**
 * @author ��ΰ</a>
 * @version createTime:2010-2-25 ����04:33:27 summary
 */
@SuppressWarnings("unchecked")
@Service
public abstract class SuperviseService {
	@Autowired
	protected ProxyService proxyService;

	public List listFeedback(Object param) {
		return proxyService.queryForList("SuperviseInfo.listFeedback", param);
	}
	/**
	 * �½�����
	 */
	public int addSupervise(SuperviseInfoModel model) {
		return ((Integer)proxyService.insert("SuperviseInfo.insertSuperviseInfo", model)).intValue();
	}
	public void modifySupervise(SuperviseInfoModel model) {
		proxyService.update("SuperviseInfo.updateSuperviseInfo", model);
	}
	public void impSupervise(SuperviseInfoModel model) {
		proxyService.update("SuperviseInfo.impSupervise", model);
	}
	public void submitSupervise(Object param) {
		proxyService.update("SuperviseInfo.updateStatus", param);
	}
	public void fulfill(SuperviseInfoModel model) {
		proxyService.update("SuperviseInfo.fulfill", model);
	}
	public void feedback(SuperviseInfoModel model) {
		proxyService.update("SuperviseInfo.feedback", model);
	}
	public void transImportant(Map param) {
		proxyService.update("SuperviseInfo.transImportant", param);
	}

	public void transClose(Map param) {
		proxyService.update("SuperviseInfo.transClose", param);
	}
	protected TaskExecutorModel addExecutor(PlanTaskModel task,String exeUserId) {
		TaskExecutorModel executor = new TaskExecutorModel();
		executor.setTaskId(task.getTaskId());
		
		executor.setTaskExeUserId(exeUserId);
		executor.setTaskExePerformType(0);
		executor.setTaskExeDispatcherId(task.getTaskDispatcher());
		executor.setTaskExeStatus(1);
		proxyService.insert("PlanTask.addExecutor", executor);
		return executor;
	}
	/**
	 * ��ѯ�б�
	 */
	public List searchSupervise(Object param) {
		return proxyService.queryForList("SuperviseInfo.searchSuperviseInfo", param);
	}
	public SuperviseInfoModel loadSupervise(Object param) throws IllegalAccessException, InvocationTargetException {
		return (SuperviseInfoModel)proxyService.queryForObject("SuperviseInfo.loadSuperviseInfo", param);
	}	
	/**
	 * ��ѯ�б�����
	 */
	public Long totalSupervise(Object param) {
		return (Long) proxyService.queryForObject("SuperviseInfo.totalSuperviseInfo", param);
	}
	public Long countSuperviseByNum(Object param) {
		return (Long) proxyService.queryForObject("SuperviseInfo.countSuperviseByNum", param);
	}	
}
